const baseConfig = require("./webpack.common")
const merge = require("webpack-merge")
const path = require("path")
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
const OptimizeCssAssetsWebpackPlugin = require("optimize-css-assets-webpack-plugin")
const TerserWebpackPlugin = require("terser-webpack-plugin")

module.exports = merge(baseConfig, {
    mode: "production",
    devtool: "nosources-source-map",
    optimization: {
        usedExports: true,
        minize: true,
        splitChunks: {
            chunks: 'all'
        },
        minizer: [
            new TerserWebpackPlugin({
                cache: true,
                parallel: true,
            }),
            new OptimizeCssAssetsWebpackPlugin()
        ]
    },
    plugins: [
        new CleanWebpackPlugin()
    ]
})